palette: make the conversion hash table volatile
authorEll <ell_se@yahoo.com>
Fri, 23 Jun 2017 11:30:40 +0000 (07:30 -0400)
committerEll <ell_se@yahoo.com>
Fri, 23 Jun 2017 11:34:48 +0000 (07:34 -0400)
... to avoid the theoretical possiblity of hash table entires being
read more than once during conversion, defying atomicity.  Very,
*very* paranoid, but what the hell :P

babl/babl-palette.c

index 3c32601f1371624c0d52e27efa1e506268756f78..ad906088745ff85693a94f995deb8b67dd9d4aae 100644 (file)
@@ -55,12 +55,14 @@ static double defpal_double[4*8*16];
 
 typedef struct BablPalette
 {
-  int         count; /* number of palette entries */
-  const Babl *format;/* the pixel format the palette is stored in */
-  unsigned char *data;  /* one linear segment of all the pixels representing the palette, in   order */
-  double        *data_double;
-  unsigned char *data_u8;
-  unsigned int   hash[HASH_TABLE_SIZE];
+  int                    count;  /* number of palette entries */
+  const Babl            *format; /* the pixel format the palette is stored in */
+  unsigned char         *data;   /* one linear segment of all the pixels
+                                  * representing the palette, in order
+                                  */
+  double                *data_double;
+  unsigned char         *data_u8;
+  volatile unsigned int  hash[HASH_TABLE_SIZE];
 } BablPalette;
 
 static void